package com.example.weight.navigation;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.net.Uri;
import androidx.appcompat.app.AppCompatActivity;

import com.example.weight.R;
import com.example.weight.greenSeasons.compost.*;
import com.example.weight.greenSeasons.flocculation.xuninggongyi;
import com.example.weight.householdWaste.ChoseRoleActivity;
import com.hjq.bar.OnTitleBarListener;
import com.hjq.bar.TitleBar;

public class SijiqingCompostNavActivity extends AppCompatActivity {
    private TitleBar titleBar;
    private String name, role, factory;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sijiqing_compost_nav);

        Intent previousIntent = getIntent();
        name = previousIntent.getStringExtra("name");
        role = previousIntent.getStringExtra("role");
        factory = previousIntent.getStringExtra("factory");
        Log.d("compostnavi", factory);


        titleBar=findViewById(R.id.titleBar);
        titleBar.setOnTitleBarListener(new OnTitleBarListener() {
            @Override
            public void onLeftClick(View v) {
                finish();
            }
            @Override
            public void onTitleClick(View v) {}
            @Override
            public void onRightClick(View v) {}
        });
    }

    public void turnEle(View view) {
        Intent intent =new Intent(SijiqingCompostNavActivity.this, duifeiyongdian.class);
        intent.putExtra("name", name);
        intent.putExtra("factory", factory);
        intent.putExtra("role", role);
        intent.putExtra("fName", "duifeiyongdian");
        Log.d("mainnaviele", factory);

        startActivity(intent);
    }

    public void turnFacCheck(View view) {
        Intent intent =new Intent(SijiqingCompostNavActivity.this, ChoseRoleActivity.class);
        intent.putExtra("name", name);
        intent.putExtra("factory", factory);
        intent.putExtra("role", role);
        intent.putExtra("fName", "duifeishebeijiancha");
        startActivity(intent);
    }

    public void turnDay(View view) {
        Intent intent =new Intent(SijiqingCompostNavActivity.this, CompostRoleSelectActivity.class);
        intent.putExtra("name", name);
        intent.putExtra("factory", factory);
        intent.putExtra("path", "daily_old");
        startActivity(intent);
    }

    public void turnWeek(View view) {
        Intent intent =new Intent(SijiqingCompostNavActivity.this, CompostRoleSelectActivity.class);
        intent.putExtra("name", name);
        intent.putExtra("factory", factory);
        intent.putExtra("path", "week");
        startActivity(intent);
    }

    public void turnMonth(View view) {
        Intent intent =new Intent(SijiqingCompostNavActivity.this, CompostRoleSelectActivity.class);
        intent.putExtra("name", name);
        intent.putExtra("factory", factory);
        intent.putExtra("path", "month");
        startActivity(intent);
    }

    public void turnFault(View view) {
        Intent intent =new Intent(SijiqingCompostNavActivity.this, duifeiguzhangjilu.class);
        intent.putExtra("name", name);
        intent.putExtra("factory", factory);
        startActivity(intent);
    }

    public void turnCraft(View view) {
        Intent intent =new Intent(SijiqingCompostNavActivity.this, duifeigongyi_old.class);
        intent.putExtra("factory", factory);
        startActivity(intent);
    }

    public void turnBrowser(View view){
        Uri uri = Uri.parse("http://39.105.29.195/#/login");
        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
        startActivity(intent);
    }
}
